package com.example.swagger.mapper;

import com.example.swagger.entity.Department;
import com.example.swagger.entity.Employee;
import org.apache.ibatis.annotations.*;

import java.util.Date;
import java.util.List;

@Mapper
public interface EmployeeMapper {
    @Select("SELECT * FROM t_employee")
    public List<Employee> getEmployees();

    @Insert("INSERT INTO t_employee(id, lastName,email,gender,department,birthday) VALUES (#{id},#{lastName},#{email},#{gender},#{department},#{birthday})")
    void insertEmployee(@Param("id") Integer id, @Param("lastName") String lastName, @Param("email") String email, @Param("gender") Integer gender, @Param("department") Department department, @Param("birthday") Date birthday);

    @Select("SELECT * FROM t_employee WHERE id=#{id}")
    public Employee getEmployeeById(Integer id);

    @Delete("DELETE FROM t_employee WHERE id = ${id}")
    void deleteEmployeeById(@Param("id") Integer id);
}
